package com.ruoyi.project.test.image;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.awt.image.Raster;
import java.io.File;
import java.io.IOException;

public class TiffAssembler {
    public static void main(String[] args) {
        try {
            // 创建一个BufferedImage对象（假设您已经有了要输出的图像数据）
            BufferedImage image = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
            for (int i = 0; i < 20; i++) {
                image.setRGB(50+i,50+i,0xFF0000);
            }

            // 设置输出文件路径
            File outputFile = new File("C:\\Users\\admin\\Desktop\\output.tiff");

            // 将BufferedImage对象输出为TIFF文件
            ImageIO.write(image, "TIFF", outputFile);

            System.out.println("TIFF文件输出完成！");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
